package com.czb.seckill.controller;

import com.czb.seckill.pojo.User;
import com.czb.seckill.service.UserService;
import com.czb.seckill.vo.RespBean;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * @author: 陈正彬
 */
@Controller
@RequestMapping("/user")
public class UserController {

    @Resource
    private UserService userService;

    //方法，返回用户登入信息，同时介绍请求携带参数address
    @RequestMapping("/info")
    @ResponseBody
    public RespBean info(User user){
//        System.out.println("address: " + address);
        return RespBean.success(user);
    }

    //方法，更新密码
    @RequestMapping("/updpwd")
    @ResponseBody
    public RespBean updatePassword(String userTicket, String password,
                                   HttpServletRequest request, HttpServletResponse response){
        return userService.updatePassword(userTicket,password,request,response);
    }
}
